import { observe } from './observe.js'
export function defineReactive (obj, key, val) {
  if (arguments.length == 2) {
    val = obj[key];
  }
  observe(val);
  Object.defineProperty(obj, key, {
    get () {
      console.log(`get-->${key}=${val}`);
      return val;
    },
    set (newVal) {
      console.log(`set-->${key}=${newVal}`);
      val = newVal;
      /* 如果newVal还是个对象的话，还是需要对newVal的属性进行响应式操作 */
      observe(newVal);
    }
  })
}